﻿using Mes.Domain.BoundedContext.EntityBase;

namespace Mes.Domain.BoundedContext.Entities.Quality
{
    /// <summary>
    /// 质量规格实体表
    /// </summary>
    public class QmSpec : NoIdEntityBase
    {
        public QmSpec() { }

        public QmSpec(string qmSpecName, string? qmSpecDesc, int editLevel, string verId, DateTime startDate, DateTime? endDate, int? entId, int? planId, int? numPtsPerPage, int displaySeq, DateTime lastEditAt)
        {
            Qm_Spec_Name = qmSpecName;
            Qm_Spec_Desc = qmSpecDesc;
            Edit_Level = editLevel;
            Ver_Id = verId;
            Start_Eff_Local = startDate;
            End_Eff_Local = endDate;
            Ent_Id = entId;
            Plan_Id = planId;
            Num_Pts_Per_Page = numPtsPerPage;
            Display_Seq = displaySeq;
            Last_Edit_At = lastEditAt;
        }

        /// <summary>
        /// 质量规格名称
        /// </summary>
        public string Qm_Spec_Name { get; set; } = string.Empty;

        /// <summary>
        /// 质量规格描述
        /// </summary>
        public string? Qm_Spec_Desc { get; set; } = null;

        /// <summary>
        /// 编辑级别
        /// Privilege level required to edit this record; default = 1
        /// </summary>
	    public int Edit_Level { get; set; } = 1;

        /// <summary>
        /// 版本
        /// </summary>
        public string Ver_Id { get; set; } = string.Empty;

        /// <summary>
        /// 开始日期，UTC时间
        /// When does this version of this specification become effective (default = current date/time)
        /// </summary>
        public DateTime Start_Eff_Utc { get; set; } = DateTime.Now;

        /// <summary>
        /// 开始日期，本地时间
        /// When does this version of this specification become effective (default = current date/time)
        /// </summary>
	    public DateTime Start_Eff_Local { get; set; } = DateTime.Now;

        /// <summary>
        /// 结束日期，UTC时间
        /// When does this version of this specification cease to be effective (null = when there is a qm_spec record with the same name but a later start_eff date - i.e. when this one is superseded)
        /// </summary>
        public DateTime? End_Eff_Utc { get; set; } = null;

        /// <summary>
        /// 结束日期，本地时间
        /// When does this version of this specification cease to be effective (null = when there is a qm_spec record with the same name but a later start_eff date - i.e. when this one is superseded)
        /// </summary>
        public DateTime? End_Eff_Local { get; set; } = null;

        /// <summary>
        /// 实体id
        /// Entity or entity class to which this specification applies
        /// </summary>
        public int? Ent_Id { get; set; } = null;

        /// <summary>
        /// 物料id
        /// Item to which this specification applies; if not null, item_category_id must be null
        /// </summary>
        public int? Item_Id { get; set; } = null;

        /// <summary>
        /// 物料类别id
        /// Item category to which this specification applies; if not null, item_id must be null
        /// </summary>
	    public int? Item_Category_Id { get; set; } = null;

        /// <summary>
        /// 工艺id
        /// Process and operation to which this specification applies; either both must be null or both non-null
        /// </summary>
        public string? Process_Id { get; set; } = null;

        /// <summary>
        /// 工序id
        /// Process and operation to which this specification applies; either both must be null or both non-null
        /// </summary>
	    public string? Oper_Id { get; set; } = null;

        /// <summary>
        /// 质量规格类别ID
        /// Process and operation to which this specification applies; either both must be null or both non-null
        /// </summary>
        public int Category_Id { get; set; } = 0;

        /// <summary>
        /// 采样计划id
        /// Default sample plan for this specification
        /// </summary>
        public int? Plan_Id { get; set; } = null;

        /// <summary>
        /// 每页点数
        /// Default number of points per page for chart
        /// </summary>
	    public int? Num_Pts_Per_Page { get; set; } = null;

        /// <summary>
        /// 显示顺序
        /// To specify sequence of specifications
        /// </summary>
        public int Display_Seq { get; set; } = 1;

        /// <summary>
        /// 备用字段1
        /// </summary>
        public string? Spare1 { get; set; } = null;

        /// <summary>
        /// 备用字段2
        /// </summary>
        public string? Spare2 { get; set; } = null;

        /// <summary>
        /// 备用字段3
        /// </summary>
	    public string? Spare3 { get; set; } = null;

        /// <summary>
        /// 备用字段4
        /// </summary>
	    public string? Spare4 { get; set; } = null;

        /// <summary>
        /// 最新更新备注，为何更新
        /// </summary>
	    public string? Last_Edit_Comment { get; set; } = null;

        /// <summary>
        /// 最新更新用户
        /// </summary>
	    public string Last_Edit_By { get; set; } = string.Empty;

        /// <summary>
        /// 最新更新时间
        /// </summary>
        public DateTime Last_Edit_At { get; set; } = DateTime.Now;

        /// <summary>
        /// 质量规格id，主键
        /// </summary>
	    public int Qm_Spec_Id { get; set; } = 0;
    }
}
